'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM } = Sequelize;
    // 创建表
    await queryInterface.createTable('courses', {
      id: {
        type: INTEGER(20).UNSIGNED,
        primaryKey: true,
        autoIncrement: true
      },
      coursesname: {
        type: STRING(200),
        allowNull: false,
        defaultValue: '',
        comment: '课程名称',
      },
      originalprice: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '课程价格',
      },
      sellingprice: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '课程售价',
      },
      coursessellstatus: {
        type: INTEGER(1),
        allowNull: false,
        defaultValue: 1,
        comment: '上架 0禁用1启用' 
      },
      coursescoverimg: {
        type: STRING(260),
        comment: '主图',
      },
      coursestype: {
        type: INTEGER(1),
        allowNull: false,
        comment: '课程类型 1个人成长 2亲密关系 3亲子关系 4情绪管理' 
      },
      coursesimg: {
        type: STRING(260),
        comment: '副图',
      },
      coursesrecommend: {
        type: INTEGER(1),
        allowNull: false,
        defaultValue: 1,
        comment: '推荐 0禁用1启用' 
      },
      courseslecturer: {
        type: STRING(200),
        allowNull: false,
        defaultValue: '',
        comment: '课程老师' 
      },
      coursesdetailcontent: {
        type: STRING(10000),
        allowNull: true,
        defaultValue: '',
        comment: '课程详细' 
      },
      created_at: DATE,
      updated_at: DATE
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('courses');
  }
};

